﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using Microsoft.Forums.OfflineStore;

namespace Microsoft.Forums.ForumsClient.Views
{
    /// <summary>
    ///  Class to convert an integer to true if it is greater than zero
    /// </summary>
    public class GreaterThanZeroToTrueConverter : IValueConverter
    {
        /// <summary>
        /// If the value greater than zero return true
        /// </summary>
        /// <param name="value">the integer to check</param>
        /// <param name="targetType">Should be boolean</param>
        /// <param name="parameter">not used</param>
        /// <param name="culture">not used</param>
        /// <returns>True if greater than zero </returns>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
                throw new ArgumentNullException("value");
            
            return (int)value > 0;
        }

        /// <summary>
        /// Method Not Implemented. Throws NotSupportedException
        /// </summary>
        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException("ConvertBack is not supported.");
        }
    }
}
